import { reactive } from 'vue';

export const usegTablePage = (pageApi: Promise<any>, params) => {
    const page = reactive({
        pageNumber: 1,
        pageSize: 10,
        total: 0,
    })
    let tableData = ref([])
    const showLoading = ref(false)
    const pageChange = (pageApi, params) => {
        showLoading.value = true

        pageApi(params).then((res) => {
            tableData.value = res.data
            showLoading.value = false

        })
    }
    pageChange(pageApi, params)

    return {
        tableData,
        page,
        pageChange,
        showLoading
    }
}